<template>
    <Table 
        border
        stripe
        :columns="columns"
        :data="data.data"
        :loading="data.isLoading">
    </Table>
</template>
<script>
import filterTime from '@/filters/filterTime.js'

export default {
    name: 'RechargeRecordListView.vue',
    props: ['data'],
    data() {
        return {
            columns: [
                {
                    title: '编号',
                    key: 'id',
                    width: 80,
                    tooltip: true,
                    align: 'center'
                },
                {
                    title: '用户id',
                    key: 'user_id',
                    width: 80,
                    tooltip: true,
                    align: 'center'
                },
                {
                    title: '名称',
                    key: 'user_name',
                    width: 200,
                    tooltip: true,
                    align: 'center'
                },
                {
                    title: '用户头像图片',
                    key: 'user_headimg',
                    width: 200,
                    align: 'center',
                    render: function(h,params){
                        // params 包含 row、column 和 index，分别指当前行数据，当前列数据，当前行索引
                        let icons;
                        return h('img',{
                            attrs: {src: (params.user_headimg)},
                            style: {
                                width: "50px",
                                verticalAlign: "middle"
                            },
                        },'img');
                    }
                },
                {
                    title: '金币',
                    key: 'coins',
                    width: 80,
                    tooltip: true,
                    align: 'center'
                },
                {
                    title: '充值时间',
                    key: 'recharge_time',
                    width: 160,
                    tooltip: true,
                    align: 'center',
                    render: function(h,params){
                        // params 包含 row、column 和 index，分别指当前行数据，当前列数据，当前行索引
                        return h('span',filterTime.formatTimestamp(params.row.recharge_time));
                    }
                },
                {
                    title: '操作',
                    key: 'action',
                    width: 300,
                    align: 'center',
                    render: (h, params) => {
                        // let detailBtn = h('Button', {
                        //     props: {
                        //         type: 'primary',
                        //         size: 'small'
                        //     },
                        //     style: {
                        //         marginRight: '5px'
                        //     },
                        //     on: {
                        //         click: () => {
                        //             this.onAction({action: 'detail', params: params})
                        //         }
                        //     }
                        // }, '详情');
                        // let delBtn = h('Button', {
                        //     props: {
                        //         type: 'error',
                        //         size: 'small'
                        //     },
                        //     on: {
                        //         click: () => {
                        //             this.onAction({action: 'remove', params: params})
                        //         }
                        //     }
                        // }, '删除');
                        return h('div', '');
                    }
                }
            ]
        }
    },
    methods: {
        onAction (actionData) {
            this.$emit('on-action',actionData);
        }
    }
}
</script>
<style lang="less" scoped>

</style>



